package com.huawei;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;

/**
 * Created by Z-hong on 2024/7/10.
 */

public class HJ27 {
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        int count =sc.nextInt();
        String [] arr= new String[count];
        for(int i=0;i<count;i++){
            arr[i]= sc.next();
        }
        String target = sc.next();
        int i =sc.nextInt();
        List<String> list= new ArrayList<String>();

        for(int j=0;j<arr.length;j++){
            if(arr[j].length()!= target.length()||arr[j].equals(target)){continue;}
            //如果arr[j]字母数量以及种类和target相等，就加入到list中

            if(isSame(arr[j],target)){
                list.add(arr[j]);
            }
        }
        Collections.sort(list,(a,b)->a.compareTo(b));
        System.out.println(list.size());
        if(list.size()>=i){        System.out.println(list.get(i-1));
        }
    }

    public static boolean isSame(String s1,String s2){
        int [] arr1=new int[26];
        char[] s1Arr = s1.toCharArray();
        char[] s2Arr = s2.toCharArray();
        for(int i=0;i<s1Arr.length;i++){
            arr1[s1Arr[i]-'a']++;
        }
        for (int i = 0; i < s2Arr.length; i++) {
            arr1[s2Arr[i]-'a']--;
            if(arr1[s2Arr[i]-'a']<0){
                return false;
            }
        }
        return true;
    }
}
